<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="signupForm">
                        <input id="id" name="id" th:value="${info.id}"
                               class="form-control" type="hidden">
                        <input id="type" name="type" th:value="${info.type}"
                               class="form-control" type="hidden">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">赛事：</label>
                            <div class="col-sm-8">
                                <input id="name" name="name" th:value="${info.name}"
                                       class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">日期：</label>
                            <div class="col-sm-8">
                                <input type="text"class="form-control" onFocus="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                                       th:value="${#dates.format(info.eventsTime, 'yyyy-MM-dd HH:mm:ss')}" id="eventsTime" name="eventsTime"  placeholder="日期"  />

                                <!--                                <input id="eventsTime" name="eventsTime" th:value="${info.eventsTime}"-->
                                <!--                                       class="form-control" type="text">-->
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">主队：</label>
                            <div class="col-sm-8">
                                <input id="homeTeam" name="homeTeam" th:value="${info.homeTeam}"
                                       class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">主队图片：</label>
                            <div class="col-sm-8">
                                <input id="pictureUrl1" name="homeTeamImg" type="hidden" th:value="${info.homeTeamImg}">
                                <input id="file1"  style="display: none" type="file" hidden  onchange="getFile(this,1)" >
                                <div class="layui-upload">
                                    <button type="button" class="btn btn-primary" id="imgUpload1" onclick="chooseFile(1)">选择文件</button>
                                    <!--                                    <button type="button" class="btn btn-primary" id="addBut" onclick="uploadFile()">开始上传</button>-->
                                </div>
                                <img id="imgUrl1" th:src="${info.homeTeamImg}" width="80" height="80"/>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">客队：</label>
                            <div class="col-sm-8">
                                <input id="visitingTeam" name="visitingTeam"
                                       th:value="${info.visitingTeam}" class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">客队图片：</label>
                            <div class="col-sm-8">
                                <input id="pictureUrl2" name="visitingTeamImg" type="hidden" th:value="${info.visitingTeamImg}">
                                <input id="file2"  style="display: none" type="file" hidden  onchange="getFile(this,2)" >
                                <div class="layui-upload">
                                    <button type="button" class="btn btn-primary" id="imgUpload2" onclick="chooseFile(2)">选择文件</button>
                                    <!--                                    <button type="button" class="btn btn-primary" id="addBut" onclick="uploadFile()">开始上传</button>-->
                                </div>
                                <img id="imgUrl2" th:src="${info.visitingTeamImg}" width="80" height="80"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">推荐选项：</label>
                            <div class="col-sm-8">
                                <input id="recommend" name="recommend" th:value="${info.recommend}"
                                       class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label ">预测盈利率：</label>
                            <div class="col-sm-8">
                                <input id="forecast" name="forecast"
                                       th:value="${info.forecast}" class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group" id="recommendReasonD" >
                            <label class="col-sm-3 control-label ">推荐理由：</label>
                            <div class="col-sm-8">
                                <input id="recommendReason" maxlength="100" name="recommendReason"
                                       th:value="${info.recommendReason}" class="form-control"
                                       type="text">
                            </div>
                        </div>
                        <div class="form-group" id="priceD" >
                            <label class="col-sm-3 control-label ">查看费用：</label>
                            <div class="col-sm-8">
                                <input id="price" name="price"
                                       th:value="${info.price}" class="form-control"
                                       type="text">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label ">类型：</label>
                            <div class="col-sm-8">
                                <select data-placeholder="赛事类型" id="eventsType" class="form-control chosen-select" tabindex="2" style="width: 100%">
                                    <option value="1" th:style="${info.eventsType == 1 ? 'selected':''}">足球</option>
                                    <option value="2" th:style="${info.eventsType == 2 ? 'selected':''}">篮球</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button type="submit" class="btn btn-primary">保存</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/appjs/common/recommend/member/edit.js"></script>
<script>

    var alists={};

    $(function () {
        sts();
    })


    function chooseFile(num) {
        $("#file"+num).trigger("click");
    }




    function sts(){
        $.ajax({
            type : "GET",
            url : "/member/sts",
            error : function(request) {
                parent.layer.alert("Connection error");
            },
            success : function(data) {
                console.log(data);
                if (data.resultCode == '000') {
                    alists=data.data;
                }
            }
        });
    }

    function getFile(obj,num){
        var file=obj.files[0];
        if (file.size>3*1024*1024){
            $.alert({
                title:alertError,
                content:"上传图片不能大于3M"
            });
            return false;
        }
        if(!checkFileType(obj))
            return false;
        var reader = new FileReader();
        reader.readAsDataURL(file);
        console.log(file);
        reader.onload=function(e){
            $('#imgUrl'+num).get(0).src = e.target.result;
        };
    }


</script>
</body>
</html>
